package com.sdgakj.entity;

import org.springframework.data.annotation.Transient;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Entity
@Table(name="f_role")
public class Role implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	/**id自增*/
	private Long id;
	private String rolename;
	private String description;
	private String deltag;
	private Date createdate;
	private List<RolePermission>  permissionlist;
	public Role() {

	}	
	
	public Role(Long id) {
		this.id = id;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	
	public void setId(Long id) {
		this.id = id;
	}
	
	public String getRolename() {
		return rolename;
	}
	
	public void setRolename(String rolename) {
		this.rolename = rolename;
	}
	
	public String getDescription() {
		return description;
	}
	
	public void setDescription(String description) {
		this.description = description;
	}
	
	public String getDeltag() {
		return deltag;
	}
	
	public void setDeltag(String deltag) {
		this.deltag = deltag;
	}
	
	public Date getCreatedate() {
		return createdate;
	}
	
	public void setCreatedate(Date createdate) {
		this.createdate = createdate;
	}
	
	@OneToMany(cascade = CascadeType.ALL,fetch=FetchType.EAGER,mappedBy ="role",orphanRemoval = true)
	@Transient
	public List<RolePermission> getPermissionlist() {
		return permissionlist;
	}

	public void setPermissionlist(List<RolePermission> permissionlist) {
		this.permissionlist = permissionlist;
	}

	@Override
	public String toString() {
		return "Role [rolename=" + rolename + ", description=" + description + ", deltag=" + deltag + ", createdate="
				+ createdate + "]";
	}



}
